<template>
	<view >
		<f-navbar :title="$t('pagetitle.pay')" navbarType='2' @leftClick='leftClick'></f-navbar>
		<f-pay :show="true" @payResult="gotopage" :payMoney="orderinfo.totalmoney" :tradeNo="orderNo" :downtimes="orderinfo.add_time"></f-pay>
	</view>
</template>

<script>
import {mapState, mapMutations} from 'vuex'
import { setPay,wxPublicPay } from '@/config/pay'; //支付需进入设置您的支付接口
import fPay from '@/pagesPackageA/components/module/f-pay/f-pay';
import fNavbar from '@/components/module/f-navbar/f-navbar';
import { api_order_view,api_assets_paymentaccount } from '@/config/api.js';
	export default {
    components:{
        fPay,fNavbar
    },
		data() {
			return {
				orderNo:'',//支付单号
				orderinfo:[]
			}
		},
		computed:{
			...mapState(['userInfo','siteInfo']),
		},
		// async created(){
		// 	await api_assets_paymentaccount({}).then((res) => {
		// 		console.log('paymentaccount',res)
		// 		this.paymentaccount=res
		// 	}).catch((e) => {});
		// },
		onLoad(options) {
			uni.setNavigationBarTitle({title: this.$t('pagetitle.pay')});
			this.orderNo = options.order_code;
			//this.get_paymentaccount()
			this.orderview(this.orderNo)
			
		},

		methods: {
			leftClick(){
				this.$tools.goJump('/pages/index/index',{},'','tab')
			},
			gotopage(goPayPageParameter){
				console.log(goPayPageParameter)
				return;
				let url='/pages/user/result?goPayPageParameterData=' + JSON.stringify(goPayPageParameter)
				this.$tools.goJump(url,{},'','launch')
			},

			orderview(){
				api_order_view({
				  orderNo: this.orderNo,
				}).then((res) => {
					console.log('orderview',res)
					this.orderinfo = res;
				if (this.orderinfo.pay_status==1){
					var goPayPageParameter = {
						tradeNo: this.orderNo, //订单号
						payMoney: parseFloat(this.orderinfo.totalmoney), //付款金额
						payStatus: 2, //2成功、0失败 2正在查询支付结果3：支付结果未知
					}
					var goPayPageParameterData = JSON.stringify(goPayPageParameter)
					this.$tools.goJump('/pages/user/result',{goPayPageParameterData:goPayPageParameterData},'','launch')
				}
				}).catch((e) => {});
			},
		
		}
	}
</script>

<style lang="scss" scoped>
	page,body{
		height: 100%;
	}
	.ordertab{
		background: #ffffff;
		border-bottom: solid 1px #eee;
	}
	.orderbox{
		margin: 10px;
		border: #e8e8e8 solid 1px;
		border-radius: 10px;
	}
</style>
